package com.jsgt.greekfire.ui.coin.adapter

import android.content.Context
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jsgt.greekfire.R
import com.jsgt.greekfire.ui.coin.ordermanagement.HistoricalOrdersBean

class HistoricalOrderAdapter (
    context: Context,
    layoutId: Int,
    data: MutableList<HistoricalOrdersBean>? = null
) : BaseQuickAdapter<HistoricalOrdersBean, BaseViewHolder>(layoutId, data) {
    override fun convert(helper: BaseViewHolder, item: HistoricalOrdersBean) {
        item?.let {
            helper.setText(R.id.tvCurrency, item?.currency)
                .setText(R.id.tvCurrency1, "/ETH")
                .setText(R.id.tvTime,context.resources.getString(R.string.historical_order_text2)+"12:12")
                .setText(R.id.tvPrice,context.resources.getString(R.string.historical_order_text1)+"(USDT)")
                .setText(R.id.tvNum, context.resources.getString(R.string.coinList_text3)+"ETH")
                .setText(R.id.tvTime1, item?.time)
                .setText(R.id.tvPrice1, item?.price)
                .setText(R.id.tvNum1,  item?.num)
            if (item?.type.equals("1")) {
                helper.setBackgroundResource(R.id.tvType, R.drawable.buy_shape)
                helper.setText(R.id.tvType, "买")
            } else {
                helper.setBackgroundResource(R.id.tvType,  R.drawable.sell_shape)
                helper.setText(R.id.tvType, "卖")
            }
        }
    }

}